function getObj(name)
{
  if (document.getElementById) { return document.getElementById(name); }
  else if (document.all) { return document.all[name]; }
  else if (document.layers) { return document.layers[name]; }
}
function getBrowser(name)
{
  if (document.getElementById) { return "IE5"; }
  else if (document.all) { return "IE4"; }
  else if (document.layers) { return "NS"; }
}
function switchFormAction(pageType){
	if (pageType == "ec") {
		document.form1.action = "http://www.zenatdesign.com/PaypalProDemo/ec_to_paypal.php";
	}else{
		document.form1.action = "http://www.zenatdesign.com/PaypalProDemo/dcc_confirm.php";
	}
}
function changePage(pageType) {
	var browserType = getBrowser("cc_info");
	var visText = "visible";
	var novisText = "hidden";
	if (browserType == "IE5") {
		var visText = "block";
		var novisText = "none";
	}
	
	if (browserType == "IE5") {
		if (pageType == "ec") {
			objName = getObj("cc_info");
			objName.style.display = novisText;
			objName = getObj("billing_address");
			objName.style.display = novisText;
			objName = getObj("shipping_address");
			objName.style.display = novisText;
		} else {
			objName = getObj("cc_info");
			objName.style.display = visText;
			objName = getObj("billing_address");
			objName.style.display = visText;
			objName = getObj("shipping_address");
			objName.style.display = visText;
		}
	}
	else if (browserType == "IE4") {
		if (pageType == "ec") {
			objName = getObj("cc_info");
			objName.style.visibility = novisText;
			objName = getObj("billing_address");
			objName.style.visibility = novisText;
			objName = getObj("shipping_address");
			objName.style.visibility = novisText;
		} else {
			objName = getObj("cc_info");
			objName.style.visibility = visText;
			objName = getObj("billing_address");
			objName.style.visibility = visText;
			objName = getObj("shipping_address");
			objName.style.visibility = visText;
		}
	}
	else {
		if (pageType == "ec") {
			objName = getObj("cc_info");
			objName.style.visibility = novisText;
			objName = getObj("billing_address");
			objName.style.visibility = novisText;
			objName = getObj("shipping_address");
			objName.style.visibility = novisText;
		} else {
			objName = getObj("cc_info");
			objName.style.visibility = visText;
			objName = getObj("billing_address");
			objName.style.visibility = visText;
			objName = getObj("shipping_address");
			objName.style.visibility = visText;
		}
	}
	switchFormAction(pageType);
}

function Require(obForm,szFields)
{	
	 	cardNumber = new String(obForm.elements['CreditCardNumber'].value)
		switch (obForm.elements['CreditCardType'].value) {
		 case "Visa" : 
		 	if (cardNumber.substring(0, 1) != "4") {
				alert("The card number you entered is not a Visa.");
				return false;
			}
			break;
		 case "MasterCard" : 
		 	if (cardNumber.substring(0, 1) != "5") {
				alert("The card number you entered is not a Mastercard.");
				return false;
			}
			break;
		 case "American Express" : 
		 	if ((cardNumber.substring(0, 2) != "34") && (cardNumber.substring(0, 2) != "37")) {
				alert("The card number you entered is not an American Express.");
				return false;
			}
			break;
		 case "Discover" : 
		 	if ((cardNumber.substring(0, 2) != "30")&&(cardNumber.substring(0, 2) != "36")&&(cardNumber.substring(0, 2) != "38")) {
				alert("The card number you entered is not a Discover.");
				return false;
			}
			break;
		 default : break;
		}





      return true; -IE
}

